package io;

import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.IOException;

/**
 * @author Cheng Jun
 * Description: BufferedInputStream 缓存式的字节输入流
 * @version 1.0
 * @date 2022/8/14 13:33
 * @see BufferedInputStream
 */
public class BufferedInputStreamExample {
    public static void main(String[] args) throws IOException {
        read();
    }

    private static void read() throws IOException {
        FileInputStream fileInputStream = new FileInputStream("src/io/TestFile/ForOutPutStreamExample.txt");
        BufferedInputStream bufferedInputStream = new BufferedInputStream(fileInputStream);
        int readData = -1;
        while ((readData = bufferedInputStream.read()) != -1) {
            System.out.print((char) readData);
        }
        bufferedInputStream.close();
    }

}
